import 'dart:ui';

import 'package:chart/pieChart.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import 'barChart.dart';
import 'lineChart.dart';
import 'route/route.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      scrollBehavior: const MaterialScrollBehavior()
          .copyWith(scrollbars: true, dragDevices: _kTouchLikeDeviceTypes),
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      routerConfig: MyRoute.router,
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body:  SizedBox(
        width: double.infinity,
        height: double.infinity,
        child:  Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            InkWell(
              onTap: (){
                  context.go('/lineChart');
              },
              child:   const Text('折线图',style: TextStyle(fontSize: 30,color: Colors.black),),
            ),

            InkWell(
              onTap: (){
                context.go('/pieChart');
              },
              child:    const Text('饼状图',style: TextStyle(fontSize: 30,color: Colors.black),),
            ),

            InkWell(
              onTap: (){
                context.go('/barChart');
              },
              child:   const Text('柱状图',style: TextStyle(fontSize: 30,color: Colors.black),),
            ),

            InkWell(
              onTap: (){
                context.go('/radarChart');
              },
              child:   const Text('雷达图',style: TextStyle(fontSize: 30,color: Colors.black),),
            ),

            InkWell(
              onTap: (){
                context.go('/areaChart');
              },
              child:   const Text('面积图',style: TextStyle(fontSize: 30,color: Colors.black),),
            ),

            InkWell(
              onTap: (){
                context.go('/scatterChart');
              },
              child:   const Text('散点图',style: TextStyle(fontSize: 30,color: Colors.black),),
            ),

          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

final Set<PointerDeviceKind> _kTouchLikeDeviceTypes = <PointerDeviceKind>{
  PointerDeviceKind.touch,
  PointerDeviceKind.mouse,
  PointerDeviceKind.stylus,
  PointerDeviceKind.invertedStylus,
  PointerDeviceKind.unknown
};

